package com.aloaproject.ciquta;

/**
 * Return true only if at least one {@link Criterion criterions} return true.
 * @author Daniele Demichelis
 */
public final class OrCriterion extends MultipleCriterion {

    OrCriterion() {
        super();
    }

    OrCriterion(final Criterion... criterions) {
        super(criterions);
    }

    public boolean match(final Object object) {
        boolean match = false;
        for(int i=0; match == false && i < getCriterions().size(); i++){
            match = match || getCriterions().get(i).match(object);
        }
        return match;
    }

}
